import { Component, OnInit, ViewChild, TemplateRef } from '@angular/core';
import { _HttpClient, ModalHelper } from '@delon/theme';
import { STColumn, STComponent, STData } from '@delon/abc';
import { SFSchema } from '@delon/form';
import { SPage, ColumnType } from '@shared/components/table-page/table-page.component';
import { NzModalService } from 'ng-zorro-antd';
import { ApiService } from '@core/services/api';
import { InoutDetailComponent } from '../inout-detail/inout-detail.component';

@Component({
  selector: 'app-access-records-access-list',
  templateUrl: './access-list.component.html',
})
export class AccessListComponent implements OnInit {
  @ViewChild('st', { static: false }) st: STComponent;
  isVisible = false;
  config: SPage = {
    columns: [
     /* {
        index: 'id',
        title: '多选',
        type: ColumnType.checkbox,
      },*/
      {
        index: 'name',
        title: '人员姓名',
        filter: {
          type: 'string'
        }
      },
      {
        index: 'houseAddr',
        title: '房屋地址',
        /*filter: {
          placeholder: '请输入房屋地址',
          type: 'string'
        }*/
      },
      {
        index: ' roomId',
        title: '房号',
        filter: {
          placeholder: '请输房号',
          type: 'string'
        }
      },
      {
        index: 'createTime',
        title: '开门时间',
        filter: {
          type: 'date'
        }
      },
      {
        index: 'type',
        title: '开门方式',
        filter: {
          placeholder: '请选择开门方式',
          type: 'select',
          items:[
            {label:'人脸识别',value: '1'},
            {label:'可视对讲',value: '2'},
            {label:'APP',value: '3'},
            {label:'智能门卡',value: '4'},
          ]
        }
      },
      {
        index: 'recordPhotopath',
        title: '实时照片',
        type:ColumnType.img
      }
    ],
    showCheckBox: true,
    editBtn:[
      {title:'查看详情'}
    ],
    reqUrl: this.api.inout.page.url
  }

  constructor(private http: _HttpClient, private modal: NzModalService, private api: ApiService) { }

  ngOnInit() { }

// 操作区
operate(e): void {
    if (e.title === '查看详情') {
      const detailModal = this.modal.create({
        nzTitle: '出入记录详情',
        nzContent: InoutDetailComponent,
        nzWidth: '60%',
        nzFooter: null,
        nzComponentParams: {
          param: e.data
        }
      })
    }
}
// 选择数据
selectChange(e) {
  console.log(e);

}

}
